package com.youle.youleservice.util;

import com.apkfuns.logutils.LogUtils;
import com.youle.youleservice.bean.Location;

import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.AES;
import cn.hutool.json.JSONUtil;

/**
 * Created by Administrator on 2018/8/8.
 */

public class AESUtil {

    private static String aesKey = "a264a2cce80164ag";
    /**
     * 加密
     *
     * @param params
     * @return
     */
    public static String encrypt(String params) {
        AES aes = SecureUtil.aes(aesKey.getBytes());
        return aes.encryptHex(params.getBytes());// 加密为16进制表示
    }

    /**
     * 解密
     *
     * @param params
     * @return
     */
    public static String decrypt(String params) {
        AES aes = SecureUtil.aes(aesKey.getBytes());
        String decryptStr = aes.decryptStr(params);
        return decryptStr;

    }

    public static void main(String[] args){
        String s = "492a382486115ad5b4abbaba799061de245108e62e0ccdff2871dbc4ba72dc839a404ff19eb82082b8ef0827dd0abda44c819cccb6057b4b594c9539900e774e5dc6540aa02a5ca829a15daef0784bbe74f3bcddc9e6f438663d46c2a9ff388d314bb2bcd21301ccc525cc89375a7e1c70be1d12c053ff509650dfe8a454d140077d92527a05dd8f94c9e68156605b8b650460b938761d5e8b8e21adaf03152dcd79cffdcbb7cd76f5fd822f7fbb04e141fcfc139aea06aaff7ceb48cf72ff5f6c3bfb956b9f41c38c532e949a9eab8a3ca02c894e0ec48d0564aceb7a44c8353db6992554ee466739ee8e2ad5d71a955eb9c835044faf4d741b9baea957e9e67cc3f1b3cbdbea306178ce5b0397d66de35f44f067fba5edb48cc769fd718439fa458afd9f7e56af4dd14dc39e3a61f5e3317d1cac276cb55903c88469cbec041dbf9a3a31b76496903b2fc109692df977557cbb8362f80d64ab8058f7875f7b668ef31d8aa86e259f6680b8bbc60bd09187b3d1c4f24c198e22cfdc41ec7079";
        String ss = decrypt(s);
        LogUtils.d("ss="+ss);
    }

}
